home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / jackal.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  23KB  |  627 lines

  1. /***************************************************************************
  2.  
  3.   jackal.c
  4.  
  5.   Written by Kenneth Lin (kenneth_lin@ai.vancouver.bc.ca)
  6.  
  7. Notes:
  8. - The high score table colors are wrong, are there proms missing?
  9. - The sprite drawing code could use a rewrite
  10. - Sprite lag
  11. - After game over, the first main logo screen is one line out of sync after
  12.   the scrolling is completed.
  13. - One of the bootleg Top Gunner gfx ROMs seems to be bad.
  14.  
  15.  
  16. 1st CPU memory map
  17. NB. "x", "y" refers to non rotated screen.
  18. ie.
  19.  
  20.   x --> increase
  21. y  -------------------------------------------------------------
  22. | | 0                                                           |
  23. | | 0                                                           |
  24. V |                                                             |
  25.   |                                                             |
  26. i |                                                             |
  27. n |I                                                            |
  28. c |H                                                            |
  29. r |                                                             |
  30. e |                                                             |
  31. a | 0                                                           |
  32. s | 0                                                           |
  33. e |                                                             |
  34.   |                                                             |
  35.    -------------------------------------------------------------
  36.  
  37. 0000-001f  Work area (IO interface?)
  38.  
  39.     0000:    x whole screen scroll
  40.     0001:    y whole screen scroll
  41.     0002 ?    store
  42.     0003 ?    store
  43.     0004 ?  Bit 2 controls NMI, bit 4 controls IRQ, bit 5 controls FIRQ
  44.     0010:    DSW1
  45.     0011:    Player 1 controls
  46.     0012:    Player 2 controls
  47.     0013:    Coin + selftest
  48.     0018:    DSW2
  49.     0019 ?    Write value frequently (watchdog reset ?)
  50.     001C:    Memory bank selection 0x08=ALT SPRITE/0x10=ALT RAM/0x20=ALT ROM
  51.  
  52. 0020-005f  Banked ZRAM (Scroll registers?)
  53.  
  54.     0020 - 002F: 16 horizontal / vertical strips based on memory $0002
  55.  
  56. 0060-1fff  Banked COMMON RAM
  57.  
  58.     Using sprite buffer 1 (Base $3000) as example.
  59.     Add 0x800 for sprite buffer 2 (Base $3800).
  60.  
  61.     ($001C = 0x??, memory block size = 0x08, 65 entries)
  62.     0060-0067: 0060, 0061, 0062, 0063, 0064 -> 0311D, 0311E, 0311F, 03120, 03121
  63.     0068-006F: 0068, 0069, 006A, 006B, 006C -> 03122, 03123, 03124, 03125, 03126
  64.     .
  65.     .
  66.     0198-019F: 0198, 0199, 019A, 019B, 019C -> 031E0, 031E1, 031E2, 031E3, 031E4
  67.     01A0-01A7: 01A0, 01A1, 01A2, 01A3, 01A4 -> 031E5, 031E6, 031E7, 031E8, 031E9
  68.  
  69.     ($001C = 0x28, memory block size = 0x28, 49 entries)
  70.     01A8-01CF: 01AE, 01AF, 01AA, 01AC, 01A9 -> 13000, 13001, 13002, 13003, 13004
  71.     01D0-01F7: 01D6, 01D7, 01D2, 01D4, 01D1 -> 13005, 13006, 13007, 13008, 13009
  72.     01F8-021F: 01FE, 01FF, 01FA, 01FC, 01F9 -> 1300A, 1300B, 1300C, 1300D, 1300E
  73.     .
  74.     .
  75.     0900-0927: 0906, 0907, 0902, 0904, 0901 -> 130EB, 130EC, 130ED, 130EE, 130EF
  76.     0928-094F: 092E, 092F, 092A, 092C, 0929 -> 130F0, 130F1, 130F2, 130F3, 130F4
  77.  
  78.     ($001C = 0x??, memory block size = 0x28, 57 entries)
  79.     0950-0977: 0956, 0957, 0952, 0953, 0954 -> 03000, 03001, 03002, 03003, 03004
  80.     0978-099F: 097E, 097F, 097A, 097C, 0979 -> 03005, 03006, 03007, 03008, 03009
  81.     .
  82.     .
  83.     11E8-120F: 11EE, 11EF, 11EA, 11EC, 11E9 -> 03113, 03114, 03115, 03116, 03117
  84.     1210-1237: 1216, 1217, 1212, 1214, 1211 -> 03118, 03119, 0311A, 0311B, 0311C
  85.  
  86.     12F8-132F: High score table
  87.  
  88.     1340-1343: High score
  89.  
  90.     1C11:    SOUND RAM status from 2nd CPU during self test
  91.     1C12:    COLOR RAM status from 2nd CPU during self test
  92.     1C13:    ROM1 status from 2nd CPU during self test
  93.  
  94. 2000-23ff  ColorRAM (Extended VideoRAM)
  95. 2400-27ff  VideoRAM
  96. 2800-2bff  RAM
  97. 2C00-2fff  ?
  98. 3000-34ff  Sprite buffer #1
  99. 3500-37ff  (Unused)
  100. 3800-3cff  Sprite buffer #2
  101. 3D00-3fff  (Unused)
  102. 4000-bfff  Banked ROM
  103. C000-ffff  ROM
  104.  
  105. ***************************************************************************/
  106.  
  107. #include "driver.h"
  108. #include "vidhrdw/generic.h"
  109. #include "cpu/m6809/m6809.h"
  110.  
  111.  
  112. extern unsigned char *jackal_videoctrl;
  113.  
  114. void jackal_init_machine(void);
  115. int jackal_vh_start(void);
  116. void jackal_vh_stop(void);
  117.  
  118. READ_HANDLER( jackal_zram_r );
  119. READ_HANDLER( jackal_commonram_r );
  120. READ_HANDLER( jackal_commonram1_r );
  121. READ_HANDLER( jackal_voram_r );
  122. READ_HANDLER( jackal_spriteram_r );
  123.  
  124. WRITE_HANDLER( jackal_rambank_w );
  125. WRITE_HANDLER( jackal_zram_w );
  126. WRITE_HANDLER( jackal_commonram_w );
  127. WRITE_HANDLER( jackal_commonram1_w );
  128. WRITE_HANDLER( jackal_voram_w );
  129. WRITE_HANDLER( jackal_spriteram_w );
  130.  
  131. void jackal_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  132. void jackal_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  133.  
  134.  
  135.  
  136. static READ_HANDLER( rotary_0_r )
  137. {
  138.     return (1 << (readinputport(6) * 8 / 256)) ^ 0xff;
  139. }
  140.  
  141. static READ_HANDLER( rotary_1_r )
  142. {
  143.     return (1 << (readinputport(7) * 8 / 256)) ^ 0xff;
  144. }
  145.  
  146. static unsigned char intenable;
  147.  
  148. WRITE_HANDLER( jackal_interrupt_enable_w )
  149. {
  150.     intenable = data;
  151. }
  152.  
  153. int jackal_interrupt(void)
  154. {
  155.     if (intenable & 0x02) return nmi_interrupt();
  156.     if (intenable & 0x08) return M6809_INT_IRQ;
  157.     if (intenable & 0x10) return M6809_INT_FIRQ;
  158.     return ignore_interrupt();
  159. }
  160.  
  161.  
  162. static struct MemoryReadAddress jackal_readmem[] =
  163. {
  164.     { 0x0010, 0x0010, input_port_0_r },
  165.     { 0x0011, 0x0011, input_port_1_r },
  166.     { 0x0012, 0x0012, input_port_2_r },
  167.     { 0x0013, 0x0013, input_port_3_r },
  168.     { 0x0014, 0x0014, rotary_0_r },
  169.     { 0x0015, 0x0015, rotary_1_r },
  170.     { 0x0018, 0x0018, input_port_4_r },
  171.     { 0x0020, 0x005f, jackal_zram_r },    /* MAIN   Z RAM,SUB    Z RAM */
  172.     { 0x0060, 0x1fff, jackal_commonram_r },    /* M COMMON RAM,S COMMON RAM */
  173.     { 0x2000, 0x2fff, jackal_voram_r },    /* MAIN V O RAM,SUB  V O RAM */
  174.     { 0x3000, 0x3fff, jackal_spriteram_r },    /* MAIN V O RAM,SUB  V O RAM */
  175.     { 0x4000, 0xbfff, MRA_BANK1 },
  176.     { 0xc000, 0xffff, MRA_ROM },
  177.     { -1 }  /* end of table */
  178. };
  179.  
  180. static struct MemoryWriteAddress jackal_writemem[] =
  181. {
  182.     { 0x0000, 0x0003, MWA_RAM, &jackal_videoctrl },    /* scroll + other things */
  183.     { 0x0004, 0x0004, jackal_interrupt_enable_w },
  184.     { 0x0019, 0x0019, MWA_NOP },    /* possibly watchdog reset */
  185.     { 0x001c, 0x001c, jackal_rambank_w },
  186.     { 0x0020, 0x005f, jackal_zram_w },
  187.     { 0x0060, 0x1fff, jackal_commonram_w },
  188.     { 0x2000, 0x2fff, jackal_voram_w },
  189.     { 0x3000, 0x3fff, jackal_spriteram_w },
  190.     { 0x4000, 0xffff, MWA_ROM },
  191.     { -1 }  /* end of table */
  192. };
  193.  
  194. static struct MemoryReadAddress jackal_sound_readmem[] =
  195. {
  196.     { 0x2001, 0x2001, YM2151_status_port_0_r },
  197.     { 0x4000, 0x43ff, MRA_RAM },        /* COLOR RAM (Self test only check 0x4000-0x423f */
  198.     { 0x6000, 0x605f, MRA_RAM },        /* SOUND RAM (Self test check 0x6000-605f, 0x7c00-0x7fff */
  199.     { 0x6060, 0x7fff, jackal_commonram1_r }, /* COMMON RAM */
  200.     { 0x8000, 0xffff, MRA_ROM },
  201.     { -1 }    /* end of table */
  202. };
  203.  
  204. static struct MemoryWriteAddress jackal_sound_writemem[] =
  205. {
  206.     { 0x2000, 0x2000, YM2151_register_port_0_w },
  207.     { 0x2001, 0x2001, YM2151_data_port_0_w },
  208.     { 0x4000, 0x43ff, paletteram_xBBBBBGGGGGRRRRR_w, &paletteram },
  209.     { 0x6000, 0x605f, MWA_RAM },
  210.     { 0x6060, 0x7fff, jackal_commonram1_w },
  211.     { 0x8000, 0xffff, MWA_ROM },
  212.     { -1 }    /* end of table */
  213. };
  214.  
  215.  
  216.  
  217. INPUT_PORTS_START( jackal )
  218.     PORT_START    /* DSW1 */
  219.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  220.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  221.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  222.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  223.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  224.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  225.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  226.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  227.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  228.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  229.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  230.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  231.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  232.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  233.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  234.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  235.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  236.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  237.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  238.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  239.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  240.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  241.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  242.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  243.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  244.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  245.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  246.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  247.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  248.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  249.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  250.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  251.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  252.     PORT_DIPSETTING(    0x00, "Invalid" )
  253.  
  254.     PORT_START    /* IN1 */
  255.     /* note that button 3 for player 1 and 2 are exchanged */
  256.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
  257.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
  258.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
  259.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
  260.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  261.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  262.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  263.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  264.  
  265.     PORT_START    /* IN2 */
  266.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
  267.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  268.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
  269.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
  270.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  271.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  272.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  273.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  274.  
  275.     PORT_START    /* IN0 */
  276.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  277.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  278.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  279.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  280.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  281.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  282.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  283.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  284.  
  285.     PORT_START    /* DSW2 */
  286.     PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
  287.     PORT_DIPSETTING(    0x03, "2" )
  288.     PORT_DIPSETTING(    0x02, "3" )
  289.     PORT_DIPSETTING(    0x01, "4" )
  290.     PORT_DIPSETTING(    0x00, "7" )
  291.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  292.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  293.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  294.     PORT_DIPNAME( 0x18, 0x18, DEF_STR( Bonus_Life ) )
  295.     PORT_DIPSETTING(    0x18, "30000 150000" )
  296.     PORT_DIPSETTING(    0x10, "50000 200000" )
  297.     PORT_DIPSETTING(    0x08, "30000" )
  298.     PORT_DIPSETTING(    0x00, "50000" )
  299.     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
  300.     PORT_DIPSETTING(    0x60, "Easy" )
  301.     PORT_DIPSETTING(    0x40, "Medium" )
  302.     PORT_DIPSETTING(    0x20, "Hard" )
  303.     PORT_DIPSETTING(    0x00, "Hardest" )
  304.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  305.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  306.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  307.  
  308.     PORT_START    /* DSW3 */
  309.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  310.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  311.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  312.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
  313.     PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
  314.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  315.     PORT_DIPNAME( 0x04, 0x00, "Sound Mode" )
  316.     PORT_DIPSETTING(    0x04, "Mono" )
  317.     PORT_DIPSETTING(    0x00, "Stereo" )
  318.     PORT_DIPNAME( 0x08, 0x00, "Sound Adj" )
  319.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  320.     PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
  321.  
  322.     /* the rotary controls work in topgunbl only */
  323.     PORT_START    /* player 1 8-way rotary control - converted in rotary_0_r() */
  324.     PORT_ANALOGX( 0xff, 0x00, IPT_DIAL, 25, 10, 0, 0, KEYCODE_Z, KEYCODE_X, 0, 0 )
  325.  
  326.     PORT_START    /* player 2 8-way rotary control - converted in rotary_1_r() */
  327.     PORT_ANALOGX( 0xff, 0x00, IPT_DIAL | IPF_PLAYER2, 25, 10, 0, 0, KEYCODE_N, KEYCODE_M, 0, 0 )
  328. INPUT_PORTS_END
  329.  
  330.  
  331.  
  332. static struct GfxLayout charlayout =
  333. {
  334.     8,8,    /* 8*8 characters */
  335.     4096,    /* 4096 characters */
  336.     8,    /* 8 bits per pixel (!) */
  337.     { 0, 1, 2, 3, 0x20000*8+0, 0x20000*8+1, 0x20000*8+2, 0x20000*8+3 },
  338.     { 0*4, 1*4, 0x40000*8+0*4, 0x40000*8+1*4, 2*4, 3*4, 0x40000*8+2*4, 0x40000*8+3*4 },
  339.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  340.     16*8    /* every char takes 16 consecutive bytes */
  341. };
  342.  
  343. static struct GfxLayout spritelayout =
  344. {
  345.     16,16,    /* 16*16 sprites */
  346.     1024,    /* 1024 sprites */
  347.     4,    /* 4 bits per pixel */
  348.     { 0, 1, 2, 3 },    /* the four bitplanes are packed in one nibble */
  349.     { 0*4, 1*4, 0x40000*8+0*4, 0x40000*8+1*4, 2*4, 3*4, 0x40000*8+2*4, 0x40000*8+3*4,
  350.             16*8+0*4, 16*8+1*4, 16*8+0x40000*8+0*4, 16*8+0x40000*8+1*4, 16*8+2*4, 16*8+3*4, 16*8+0x40000*8+2*4, 16*8+0x40000*8+3*4 },
  351.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
  352.             16*16, 17*16, 18*16, 19*16, 20*16, 21*16, 22*16, 23*16 },
  353.     64*8    /* every sprite takes 64 consecutive bytes */
  354. };
  355.  
  356. static struct GfxLayout spritelayout8 =
  357. {
  358.     8,8,    /* 8*8 characters */
  359.     4096,    /* 4096 characters */
  360.     4,    /* 4 bits per pixel */
  361.     { 0, 1, 2, 3 },    /* the four bitplanes are packed in one nibble */
  362.     { 0*4, 1*4, 0x40000*8+0*4, 0x40000*8+1*4, 2*4, 3*4, 0x40000*8+2*4, 0x40000*8+3*4 },
  363.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  364.     16*8    /* every char takes 16 consecutive bytes */
  365. };
  366.  
  367. static struct GfxLayout topgunbl_charlayout =
  368. {
  369.     8,8,    /* 8*8 characters */
  370.     4096,    /* 4096 characters */
  371.     8,    /* 8 bits per pixel (!) */
  372.     { 0, 1, 2, 3, 0x20000*8+0, 0x20000*8+1, 0x20000*8+2, 0x20000*8+3 },
  373.     { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 },
  374.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
  375.     32*8    /* every char takes 32 consecutive bytes */
  376. };
  377.  
  378. static struct GfxLayout topgunbl_spritelayout =
  379. {
  380.     16,16,    /* 16*16 sprites */
  381.     1024,    /* 1024 sprites */
  382.     4,    /* 4 bits per pixel */
  383.     { 0, 1, 2, 3 },
  384.     { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4,
  385.             32*8+2*4, 32*8+3*4, 32*8+0*4, 32*8+1*4, 32*8+6*4, 32*8+7*4, 32*8+4*4, 32*8+5*4 },
  386.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
  387.             16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 },
  388.     128*8    /* every char takes 32 consecutive bytes */
  389. };
  390.  
  391. static struct GfxLayout topgunbl_spritelayout8 =
  392. {
  393.     8,8,    /* 8*8 characters */
  394.     4096,    /* 4096 characters */
  395.     4,    /* 4 bits per pixel */
  396.     { 0, 1, 2, 3 },
  397.     { 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 },
  398.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
  399.     32*8    /* every char takes 32 consecutive bytes */
  400. };
  401.  
  402. static struct GfxDecodeInfo jackal_gfxdecodeinfo[] =
  403. {
  404.     { REGION_GFX1, 0x00000, &charlayout,          256,  1 },    /* colors 256-511 */
  405.     { REGION_GFX1, 0x10000, &spritelayout,        512, 16 },    /* colors   0- 15 with lookup */
  406.     { REGION_GFX1, 0x30000, &spritelayout,  512+16*16, 16 },    /* colors  16- 31 with lookup */
  407.     { REGION_GFX1, 0x10000, &spritelayout8,       512, 16 },  /* to handle 8x8 sprites */
  408.     { REGION_GFX1, 0x30000, &spritelayout8, 512+16*16, 16 },  /* to handle 8x8 sprites */
  409.     { -1 } /* end of array */
  410. };
  411.  
  412. static struct GfxDecodeInfo topgunbl_gfxdecodeinfo[] =
  413. {
  414.     { REGION_GFX1, 0x00000, &topgunbl_charlayout,          256,  1 },    /* colors 256-511 */
  415.     { REGION_GFX1, 0x40000, &topgunbl_spritelayout,        512, 16 },    /* colors   0- 15 with lookup */
  416.     { REGION_GFX1, 0x60000, &topgunbl_spritelayout,  512+16*16, 16 },    /* colors  16- 31 with lookup */
  417.     { REGION_GFX1, 0x40000, &topgunbl_spritelayout8,       512, 16 },    /* to handle 8x8 sprites */
  418.     { REGION_GFX1, 0x60000, &topgunbl_spritelayout8, 512+16*16, 16 },    /* to handle 8x8 sprites */
  419.     { -1 } /* end of array */
  420. };
  421.  
  422.  
  423.  
  424. static struct YM2151interface ym2151_interface =
  425. {
  426.     1,
  427.     3580000,
  428.     { YM3012_VOL(50,MIXER_PAN_LEFT,50,MIXER_PAN_RIGHT) },
  429.     { 0 },
  430. };
  431.  
  432.  
  433. static struct MachineDriver machine_driver_jackal =
  434. {
  435.     /* basic machine hardware */
  436.     {
  437.         {
  438.             CPU_M6809,
  439.             2000000,    /* 2 MHz???? */
  440.             jackal_readmem,jackal_writemem,0,0,
  441.             jackal_interrupt,1
  442.         },
  443.         {
  444.             CPU_M6809,
  445.             2000000,    /* 2 MHz???? */
  446.             jackal_sound_readmem,jackal_sound_writemem,0,0,
  447.             ignore_interrupt,1
  448.         }
  449.     },
  450.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  451.     10,    /* 10 CPU slices per frame - seems enough to keep the CPUs in sync */
  452.     jackal_init_machine,
  453.  
  454.     /* video hardware */
  455.     32*8, 32*8, { 1*8, 31*8-1, 2*8, 30*8-1 },
  456.     jackal_gfxdecodeinfo,
  457.     512, 512+16*16+16*16,
  458.     jackal_vh_convert_color_prom,
  459.  
  460.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  461.     0,
  462.     jackal_vh_start,
  463.     jackal_vh_stop,
  464.     jackal_vh_screenrefresh,
  465.  
  466.     /* sound hardware */
  467.     SOUND_SUPPORTS_STEREO,0,0,0,
  468.     {
  469.         {
  470.             SOUND_YM2151,
  471.             &ym2151_interface
  472.         }
  473.     }
  474. };
  475.  
  476. /* identical but different gfxdecode */
  477. static struct MachineDriver machine_driver_topgunbl =
  478. {
  479.     /* basic machine hardware */
  480.     {
  481.         {
  482.             CPU_M6809,
  483.             2000000,    /* 2 MHz???? */
  484.             jackal_readmem,jackal_writemem,0,0,
  485.             jackal_interrupt,1
  486.         },
  487.         {
  488.             CPU_M6809,
  489.             2000000,    /* 2 MHz???? */
  490.             jackal_sound_readmem,jackal_sound_writemem,0,0,
  491.             ignore_interrupt,1
  492.         }
  493.     },
  494.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  495.     10,    /* 10 CPU slices per frame - seems enough to keep the CPUs in sync */
  496.     jackal_init_machine,
  497.  
  498.     /* video hardware */
  499.     32*8, 32*8, { 1*8, 31*8-1, 2*8, 30*8-1 },
  500.     topgunbl_gfxdecodeinfo,
  501.     512, 512,
  502.     jackal_vh_convert_color_prom,
  503.  
  504.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  505.     0,
  506.     jackal_vh_start,
  507.     jackal_vh_stop,
  508.     jackal_vh_screenrefresh,
  509.  
  510.     /* sound hardware */
  511.     SOUND_SUPPORTS_STEREO,0,0,0,
  512.     {
  513.         {
  514.             SOUND_YM2151,
  515.             &ym2151_interface
  516.         }
  517.     }
  518. };
  519.  
  520.  
  521.  
  522.  
  523. /***************************************************************************
  524.  
  525.   Game driver(s)
  526.  
  527. ***************************************************************************/
  528.  
  529. ROM_START( jackal )
  530.     ROM_REGION( 0x20000, REGION_CPU1 )    /* Banked 64k for 1st CPU */
  531.     ROM_LOAD( "j-v02.rom",    0x04000, 0x8000, 0x0b7e0584 )
  532.     ROM_CONTINUE(             0x14000, 0x8000 )
  533.     ROM_LOAD( "j-v03.rom",    0x0c000, 0x4000, 0x3e0dfb83 )
  534.  
  535.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for 2nd cpu (Graphics & Sound)*/
  536.     ROM_LOAD( "631t01.bin",   0x8000, 0x8000, 0xb189af6a )
  537.  
  538.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  539.     ROM_LOAD( "631t04.bin",   0x00000, 0x20000, 0x457f42f0 )
  540.     ROM_LOAD( "631t06.bin",   0x20000, 0x20000, 0x2d10e56e )
  541.     ROM_LOAD( "631t05.bin",   0x40000, 0x20000, 0x732b3fc1 )
  542.     ROM_LOAD( "631t07.bin",   0x60000, 0x20000, 0x4961c397 )
  543.  
  544.     ROM_REGION( 0x0200, REGION_PROMS )    /* color lookup tables */
  545.     ROM_LOAD( "631r08.bpr",   0x0000, 0x0100, 0x7553a172 )
  546.     ROM_LOAD( "631r09.bpr",   0x0100, 0x0100, 0xa74dd86c )
  547. ROM_END
  548.  
  549. ROM_START( topgunr )
  550.     ROM_REGION( 0x20000, REGION_CPU1 )    /* Banked 64k for 1st CPU */
  551.     ROM_LOAD( "tgnr15d.bin",  0x04000, 0x8000, 0xf7e28426 )
  552.     ROM_CONTINUE(             0x14000, 0x8000 )
  553.     ROM_LOAD( "tgnr16d.bin",  0x0c000, 0x4000, 0xc086844e )
  554.  
  555.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for 2nd cpu (Graphics & Sound)*/
  556.     ROM_LOAD( "631t01.bin",   0x8000, 0x8000, 0xb189af6a )
  557.  
  558.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  559.     ROM_LOAD( "tgnr7h.bin",   0x00000, 0x20000, 0x50122a12 )
  560.     ROM_LOAD( "tgnr12h.bin",  0x20000, 0x20000, 0x37dbbdb0 )
  561.     ROM_LOAD( "tgnr8h.bin",   0x40000, 0x20000, 0x6943b1a4 )
  562.     ROM_LOAD( "tgnr13h.bin",  0x60000, 0x20000, 0x22effcc8 )
  563.  
  564.     ROM_REGION( 0x0200, REGION_PROMS )    /* color lookup tables */
  565.     ROM_LOAD( "631r08.bpr",   0x0000, 0x0100, 0x7553a172 )
  566.     ROM_LOAD( "631r09.bpr",   0x0100, 0x0100, 0xa74dd86c )
  567. ROM_END
  568.  
  569. ROM_START( jackalj )
  570.     ROM_REGION( 0x20000, REGION_CPU1 )    /* Banked 64k for 1st CPU */
  571.     ROM_LOAD( "631t02.bin",   0x04000, 0x8000, 0x14db6b1a )
  572.     ROM_CONTINUE(             0x14000, 0x8000 )
  573.     ROM_LOAD( "631t03.bin",   0x0c000, 0x4000, 0xfd5f9624 )
  574.  
  575.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for 2nd cpu (Graphics & Sound)*/
  576.     ROM_LOAD( "631t01.bin",   0x8000, 0x8000, 0xb189af6a )
  577.  
  578.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  579.     ROM_LOAD( "631t04.bin",   0x00000, 0x20000, 0x457f42f0 )
  580.     ROM_LOAD( "631t06.bin",   0x20000, 0x20000, 0x2d10e56e )
  581.     ROM_LOAD( "631t05.bin",   0x40000, 0x20000, 0x732b3fc1 )
  582.     ROM_LOAD( "631t07.bin",   0x60000, 0x20000, 0x4961c397 )
  583.  
  584.     ROM_REGION( 0x0200, REGION_PROMS )    /* color lookup tables */
  585.     ROM_LOAD( "631r08.bpr",   0x0000, 0x0100, 0x7553a172 )
  586.     ROM_LOAD( "631r09.bpr",   0x0100, 0x0100, 0xa74dd86c )
  587. ROM_END
  588.  
  589. ROM_START( topgunbl )
  590.     ROM_REGION( 0x20000, REGION_CPU1 )    /* Banked 64k for 1st CPU */
  591.     ROM_LOAD( "t-3.c5",       0x04000, 0x8000, 0x7826ad38 )
  592.     ROM_LOAD( "t-4.c4",       0x14000, 0x8000, 0x976c8431 )
  593.     ROM_LOAD( "t-2.c6",       0x0c000, 0x4000, 0xd53172e5 )
  594.  
  595.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for 2nd cpu (Graphics & Sound)*/
  596.     ROM_LOAD( "t-1.c14",      0x8000, 0x8000, 0x54aa2d29 )
  597.  
  598.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  599.     ROM_LOAD( "t-17.n12",     0x00000, 0x08000, 0xe8875110 )
  600.     ROM_LOAD( "t-18.n13",     0x08000, 0x08000, 0xcf14471d )
  601.     ROM_LOAD( "t-19.n14",     0x10000, 0x08000, 0x46ee5dd2 )
  602.     ROM_LOAD( "t-20.n15",     0x18000, 0x08000, 0x3f472344 )
  603.     ROM_LOAD( "t-13.n8",      0x20000, 0x08000, 0x5d669abb )
  604.     ROM_LOAD( "t-14.n9",      0x28000, 0x08000, 0xf349369b )
  605.     ROM_LOAD( "t-15.n10",     0x30000, 0x08000, 0x7c5a91dd )
  606.     ROM_LOAD( "t-16.n11",     0x38000, 0x08000, 0x5ec46d8e )
  607.     ROM_LOAD( "t-6.n1",       0x40000, 0x08000, 0x539cc48c )
  608.     ROM_LOAD( "t-5.m1",       0x48000, 0x08000, 0x2dd9a5e9 )
  609.     ROM_LOAD( "t-7.n2",       0x50000, 0x08000, 0x0ecd31b1 )
  610.     ROM_LOAD( "t-8.n3",       0x58000, 0x08000, 0xf946ada7 )
  611.     ROM_LOAD( "t-9.n4",       0x60000, 0x08000, 0x8269caca )
  612.     ROM_LOAD( "t-10.n5",      0x68000, 0x08000, 0x25393e4f )
  613.     ROM_LOAD( "t-11.n6",      0x70000, 0x08000, 0x7895c22d )
  614.     ROM_LOAD( "t-12.n7",      0x78000, 0x08000, 0x15606dfc )
  615.  
  616.     ROM_REGION( 0x0200, REGION_PROMS )    /* color lookup tables */
  617.     ROM_LOAD( "631r08.bpr",   0x0000, 0x0100, 0x7553a172 )
  618.     ROM_LOAD( "631r09.bpr",   0x0100, 0x0100, 0xa74dd86c )
  619. ROM_END
  620.  
  621.  
  622.  
  623. GAMEX( 1986, jackal,   0,      jackal,   jackal, 0, ROT90, "Konami", "Jackal (World)", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
  624. GAMEX( 1986, topgunr,  jackal, jackal,   jackal, 0, ROT90, "Konami", "Top Gunner (US)", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
  625. GAMEX( 1986, jackalj,  jackal, jackal,   jackal, 0, ROT90, "Konami", "Tokushu Butai Jackal (Japan)", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
  626. GAMEX( 1987, topgunbl, jackal, topgunbl, jackal, 0, ROT90, "bootleg", "Top Gunner (bootleg)", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
  627.